import apiClient from './axios'
import type { Customer } from '@/types/index'

// 获取客户列表
export const getCustomerList = async (params?: {
  page?: number
  pageSize?: number
  keyword?: string
}): Promise<{ data: Customer[]; total: number }> => {
  return apiClient.get('/customers', { params })
}

// 获取客户详情
export const getCustomerDetail = async (id: string): Promise<Customer> => {
  return apiClient.get(`/customers/${id}`)
}

// 搜索客户（用于选择器）
export const searchCustomers = async (keyword: string): Promise<Customer[]> => {
  return apiClient.get('/customers/search', { params: { keyword } })
}